package com.modakai.med.hosp.controller;

import com.modakai.med.common.result.Result;
import com.modakai.med.hosp.service.ScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Tag(name = "排班管理接口")
@RestController
@RequestMapping("/admin/hosp/schedule")
@RequiredArgsConstructor
public class ScheduleController {

    private final ScheduleService scheduleService;

    @Operation(summary = "查询排班规则数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result<Map<String, Object>> getRuleSchedule(@PathVariable long page,
                                                       @PathVariable long limit,
                                                       @PathVariable String hoscode,
                                                       @PathVariable String depcode) {
        return Result.ok(scheduleService.getRuleSchedule(page, limit, hoscode, depcode));
    }

    @Operation(summary = "查询排班详情信息")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                    @PathVariable String depcode,
                                    @PathVariable String workDate) {
        return Result.ok(scheduleService.getDetailSchedule(hoscode, depcode, workDate));
    }

}
